
<?php include ADMIN_INCLUDE_DIR."/header.php";?>

<script language="javascript" type="text/javascript">
    var popupImageParams = '&forModule=property&position=content';
    $(document).ready(function (){
        CKEDITOR.config.resize_enabled = false;
        CKEDITOR.config.width = 500;
        CKEDITOR.config.height = 200;
        CKEDITOR.replace( 'description',
        {
            toolbar :
                [['Maximize', '-','Format','Font','FontSize','-','TextColor','BGColor','-','Bold','Italic','Underline','Strike','-','NumberedList','BulletedList','-','Outdent','Indent','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock', '-','Image','Table','-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ]]
        });
    });

    function keyword_remove(no){
        if($("#removedTags").val()==''){
            $("#removedTags").val($("#removedTags").val() + $("#key"+no).val())
        }else{
            $("#removedTags").val($("#removedTags").val() + ',' + $("#key"+no).val());
        }
        $('#k'+no).html('');
        $('#k'+no).hide()
        $("#keywordAlert").hide();
        $("#keywordAlert").html('<span style="color:green;">Remove keyword successful!</span>');
        $("#keywordAlert").show();
    }

    function keyword_spam(no){
        if(no!=''){
            if($("#removedTags").val()==''){
                $("#removedTags").val($("#removedTags").val() + $("#key"+no).val())
            }else{
                $("#removedTags").val($("#removedTags").val() + ',' + $("#key"+no).val());
            }
            $.ajax({
                url: ADMIN_URL+'/index.php?module=property&action=gen-tags',
                type: 'GET',
                data: "keyword=" + $("#key"+no).val(),
                error: function(){
                    alert('Error add spam!');
                },
                success: function(){
                    $("#keywordAlert").hide('slow');
                    $('#k'+no).html('');
                    $('#k'+no).hide()
                    $("#keywordAlert").html('<span style="color:green;">Add to spam successful!</span>');
                    $("#keywordAlert").show('slow');
                }
            });
        }
    }
    //add property
    function getCategoryType(obj){
        $.ajax({
            url: ADMIN_URL+'/index.php',
            type: 'GET',
            data: "module=property&option=category&action=getCategoryType&type=" + obj.value,
            error: function(){
                alert('Error!');
            },
            success: function(data){
                $("select[name=cat_id]").html(data);
            }
        });
    }

    function getGeo(obj,forObj){
        if(obj.value>0){
            $.ajax({
                url: ADMIN_URL+'/index.php',
                type: 'GET',
                data: "module=property&option=geo&action=getGeo&geo=" + obj.value,
                error: function(){
                    alert('Error!');
                },
                success: function(data){
                    if(forObj=='city'){
                        $("select[name=geo_id[0]]").html(data);
                        $("select[name=geo_id[1]]").html('<option value="0">Select geographic...</option>');
                    }else if(forObj=='district'){
                        $("select[name=geo_id[1]]").html(data);
                    }

                }
            });
        }else{
            $("select[name=geo_id[1]]").html('<option value="0">Select geographic...</option>');
        }
    }
    function removeImage(id,imageId){
        $("#removeThumb").html('<input type="hidden" name="removeThumb[]" value="'+imageId+'"/>' + $("#removeThumb").html());
        $("#"+id).remove();
    }
    function otherLegalDoc(obj){
        if(obj.value=='3'){
            $("input[name=other_legal_doc]").show();
        }else{
            $("input[name=other_legal_doc]").hide();
        }
    }
    function showPrice(){
        //$("input[name=price]").val($("input[name=price]").val().replace(/[^0-9]/g, ''));
        //$("#showPrice").html(addCommasToNumber($("input[name=price]").val().replace(/[^0-9]/g, '')));
        if($("input[name=price]").val()==''){
            $("#showPrice").html(0);
        }else{
            $("#showPrice").html(addCommasToNumber($("input[name=price]").val()));
        }
    }
    function addCommasToNumber(numberStr){
        numberStr += '';
        x = numberStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
            x1 = x1.replace(rgx, '$1' + '.' + '$2');
        }
        return x1 + x2;
    }
    function onlyNumber(htmlInputName){
        $("input[name="+htmlInputName+"]").val(( $("input[name="+htmlInputName+"]").val().replace(/[^0-9]/g, '')));

    }
    function onlyFloatNumber(htmlInputName){
        $("input[name="+htmlInputName+"]").val(( $("input[name="+htmlInputName+"]").val().replace(/[^0-9 .]/g, '')));

    }
    $(document).ready(function (){
        //get category type
        $('input[name=type]').click(function (){
            getCategoryType(this);
        });
        //get geographic
        $('input[name=geo]').click(function (){
            getGeo(this,'city');
        });
        $("select[name=geo_id[0]]").change(function(){
            getGeo(this,'district');
        });
        //other legal doc
        $("select[name=legal_doc]").change(function(){
            otherLegalDoc(this);
        });
        //price
        $("input[name=price]").keyup(function(){
            showPrice();
        });
        //area_use
        $("input[name=area_use]").keyup(function(){
            onlyFloatNumber('area_use');
        });
        //area_campus_width
        $("input[name=area_campus_width]").keyup(function(){
            onlyFloatNumber('area_campus_width');
        });
        //area_campus_depth
        $("input[name=area_campus_depth]").keyup(function(){
            onlyFloatNumber('area_campus_depth');
        });
        //area_build
        $("input[name=area_build]").keyup(function(){
            onlyFloatNumber('area_build');
        });
        //room
        $("input[name=room]").keyup(function(){
            onlyNumber('room');
        });
        //bathRoom
        $("input[name=bathroom]").keyup(function(){
            onlyNumber('bathroom');
        });
        $("input[name=sittingroom]").keyup(function(){
            onlyNumber('sittingroom');
        });
        //bathRoom
        $("input[name=bedroom]").keyup(function(){
            onlyNumber('bedroom');
        });
        //bathRoom
        $("input[name=kitchen]").keyup(function(){
            onlyNumber('kitchen');
        });
         $("input[name=num_order]").keyup(function(){
            onlyNumber('num_order');
        });
        //floor
        $("input[name=floor]").keyup(function(){
            onlyNumber('floor');
        });

    });
    function submitFormAddProperty(submitType){
        if(submitType=='exit'){
            $("#submitType").val('exit');
            $("#submitFrmPropertyAdd").click();
        }
    }
     function searchAddress(){
        var str=$('#searchMapAddress ').val()+" "+$('#geoDistrict option:selected').text()+" "+$('#geoCity option:selected').text();
        if(str!=' '){
            showAddress(str);
        }
     }
</script>
<div class="container_l">
    <form name="formPropertyAddCategory" method="POST" action="">
        <div class="title_user"><img src="images/icon1.gif" />Quản lý sản phẩm</div>
        <div class="table_user">
            <div class="table_user_in2">
                <?php
                show_error();
                show_success();
                //print_r($rsPropertyEdit['rsPropertyEdit']);
                ?>
                <fieldset>
                    <legend accesskey="N">Sản phẩm</legend>
                    <div class="lineaddnew">
                        <div style="width:70%;float:left;">
                            <div class="lineform">
                                <div class="divlabel_news">Kiểu SP:</div>
                                <div style="margin-top:6px;">&nbsp;&nbsp;&nbsp;<label><input type="radio" name="type" value="1" <?php echo setCheckedBoxValue('sell',$rsPropertyEdit['rsPropertyEdit']['type'],true);?> /> Bán</label> &nbsp;&nbsp; <label><input type="radio" name="type" value="2" <?php echo setCheckedBoxValue('rent',$rsPropertyEdit['rsPropertyEdit']['type']);?> /> Cho thuê</label></div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Danh mục: <font color="#FF0000">*</font></div>
                                <div class="divform">
                                    <select name="cat_id">
                                        <?php
                                        $catParent = getPropertyCategoryParent($rsPropertyEdit['rsPropertyEdit']['cat_id']);
                                        $arrPropertyCat = listAllPropertyCategory($catParent['cat_parent']);
                                        for($i=0;$i<count($arrPropertyCat);$i++) {
                                            ?>
                                        <option <?php echo setSelectedBoxValue($rsPropertyEdit['rsPropertyEdit']['cat_id'], $arrPropertyCat[$i]['cat_id']);?> value="<?php echo $arrPropertyCat[$i]['cat_id'];?>"><?php echo $arrPropertyCat[$i]['cat_title'];?></option>
                                            <?php
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">VT địa lý: <font color="#FF0000">*</font></div>
                                <div style="margin-top:6px;margin-left:115px;">
                                    <?php
                                    $rsGrandCity = getPropertyGeographicGrandParent($rsPropertyEdit['rsPropertyEdit']['geo_id']);
                                    if($rsGrandCity['geo_parent']==0) {
                                        $rsGeoRootId = getPropertyGeographicParent($rsPropertyEdit['rsPropertyEdit']['geo_id']);
                                        $geoRootId = $rsGeoRootId['geo_parent'];
                                    }else {
                                        $geoRootId = $rsGrandCity['geo_parent'];
                                    }
                                    ?>
                                    <label><input type="radio" name="geo" value="1" <?php echo setCheckedBoxValue($geoRootId,'1',true);?> /> Miền bắc</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label><input type="radio" name="geo" value="2" <?php echo setCheckedBoxValue($geoRootId,'2');?> /> Miền trung</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label><input type="radio" name="geo" value="3" <?php echo setCheckedBoxValue($geoRootId,'3');?> /> Miền nam</label>
                                    <br>Thành phố:&nbsp;&nbsp;&nbsp;&nbsp; <select id="geoCity" onchange="showAddress($('#geoCity option:selected').text());" name="geo_id[0]" style="margin-top:5px;width:350px">
                                        <option value="0">Chọn thành phố...</option>
                                        <?php
                                        if($rsGrandCity['geo_parent']==0) {
                                            $rsParentCity = getPropertyGeographicParent($rsPropertyEdit['rsPropertyEdit']['geo_id']);
                                            $arrGeoCity = listAllPropertyGeographicByParent($rsParentCity['geo_parent']);
                                            for($i=0;$i<count($arrGeoCity);$i++) {
                                                echo '<option '.setSelectedBoxValue($rsPropertyEdit['rsPropertyEdit']['geo_id'], $arrGeoCity[$i]['geo_id']).' value="'.$arrGeoCity[$i]['geo_id'].'">'.$arrGeoCity[$i]['geo_title'].'</option>';
                                            }
                                        }else {
                                            $rsParentCity = getPropertyGeographicParent($rsPropertyEdit['rsPropertyEdit']['geo_id']);
                                            $arrGeoCity = listAllPropertyGeographicByParent($rsGrandCity['geo_parent']);
                                            for($i=0;$i<count($arrGeoCity);$i++) {
                                                echo '<option '.setSelectedBoxValue($rsParentCity['geo_parent'], $arrGeoCity[$i]['geo_id']).' value="'.$arrGeoCity[$i]['geo_id'].'">'.$arrGeoCity[$i]['geo_title'].'</option>';
                                            }
                                        }
                                        ?>
                                    </select>
                                    <br>Quận/Huyện:&nbsp;&nbsp;<select id="geoDistrict" onchange="showAddress($('#geoDistrict option:selected').text()+' '+$('#geoCity option:selected').text());" name="geo_id[1]" style="margin-top:5px;width:350px">
                                        <option value="0">Chọn quận/huyện...</option>
                                        <?php
                                        if($rsGrandCity['geo_parent']!=0) {
                                            $rsParentCity = getPropertyGeographicParent($rsPropertyEdit['rsPropertyEdit']['geo_id']);
                                            $arrGeoCity = listAllPropertyGeographicByParent($rsParentCity['geo_parent']);
                                            for($i=0;$i<count($arrGeoCity);$i++) {
                                                echo '<option '.setSelectedBoxValue($rsPropertyEdit['rsPropertyEdit']['geo_id'], $arrGeoCity[$i]['geo_id']).' value="'.$arrGeoCity[$i]['geo_id'].'">'.$arrGeoCity[$i]['geo_title'].'</option>';
                                            }
                                        }
                                        ?>
                                    </select>
                                    <br>Tên đường/Địa điểm:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="searchMapAddress" onkeydown="if (event.keyCode == 13){searchAddress();return false;}"  style="margin-top:5px;width:272px"/> <input type="button" onclick="searchAddress();" value="Định vị"/>
                                    <div style="margin-left: 153px;">VD: thap rua, hoang quoc viet, hoc vien tai chinh, duong truong chinh...</div>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Bản đồ:</div>
                                <div class="divform">
                                    <input type="text" id="geocodeRoboGEO" name="map" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['map'];?>" style="width: 235px;margin-bottom: 5px;display: none;" readonly/>
                                    <div id="map" style="width: 600px; height: 400px"></div>
                                    <script type="text/javascript">
<?php
$arrMap = explode(',', $rsPropertyEdit['rsPropertyEdit']['map']);
$arrMapLat = explode(':', $arrMap[0]);
$arrMapLon = explode(':', $arrMap[1]);
;?>
    $(document).ready(function (){
        load();
    });
    $(document).unload(function (){
        GUnload();
    });
    function load() {
        if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map"));
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            var center = new GLatLng(
<?php if($arrMapLat[1]!='') {
    echo $arrMapLat[1];
} else {
    echo '21.028711';
}?>,  	<?php if($arrMapLon[1]!='') {
    echo $arrMapLon[1];
} else {
    echo '105.852456';
}?>);
            map.setCenter(center, 15);
            geocoder = new GClientGeocoder();
            var marker = new GMarker(center, {draggable: true});
            map.addOverlay(marker);
            var message = 'latitude: ' + center.lat().toFixed(5) + ', longitude: ' + center.lng().toFixed(5);
            document.getElementById("geocodeRoboGEO").value = message;
            //document.getElementById("lat").innerHTML = center.lat().toFixed(5);
            //document.getElementById("lng").innerHTML = center.lng().toFixed(5);
            GEvent.addListener(marker, "dragend", function() {
                var point = marker.getPoint();
                map.panTo(point);
                var message = 'latitude: ' + point.lat().toFixed(5) + ', longitude: ' + point.lng().toFixed(5);
                document.getElementById("geocodeRoboGEO").value = message;
                //document.getElementById("lat").innerHTML = point.lat().toFixed(5);
                //document.getElementById("lng").innerHTML = point.lng().toFixed(5);
            });
            GEvent.addListener(map, "moveend", function() {
                map.clearOverlays();
                var center = map.getCenter();
                var marker = new GMarker(center, {draggable: true});
                map.addOverlay(marker);
                var message = 'latitude: ' + center.lat().toFixed(5) + ', longitude: ' + center.lng().toFixed(5);
                document.getElementById("geocodeRoboGEO").value = message;
                //document.getElementById("lat").innerHTML = center.lat().toFixed(5);
                //document.getElementById("lng").innerHTML = center.lng().toFixed(5);
                GEvent.addListener(marker, "dragend", function() {
                    var point =marker.getPoint();
                    map.panTo(point);
                    var message = 'latitude: ' + point.lat().toFixed(5) + ', longitude: ' + point.lng().toFixed(5);
                    document.getElementById("geocodeRoboGEO").value = message;
                    //document.getElementById("lat").innerHTML = point.lat().toFixed(5);
                    //document.getElementById("lng").innerHTML = point.lng().toFixed(5);
                });
            });
        }
    }
    function findAddress() {
        myAddress = document.getElementById("address").value;
        geocoder.getLocations(myAddress, getCoordForAddress);
    }
    function showAddress(address) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        if (geocoder) {
            geocoder.getLatLng(
            address,
            function(point) {
                if (!point) {
                    alert("Xin loi, chung toi khong tim thay " + address);
                    var message = 'latitude: ' + 21.028711 + ', longitude: ' + 105.852456;
                    document.getElementById("geocodeRoboGEO").value = message;
                    //document.getElementById("lat").innerHTML = point.lat().toFixed(5);
                    //document.getElementById("lng").innerHTML = point.lng().toFixed(5);
                    map.clearOverlays()
                    map.setCenter(point, 14);
                    var marker = new GMarker(point, {draggable: true});
                    map.addOverlay(marker);

                    GEvent.addListener(marker, "dragend", function() {
                        var pt = marker.getPoint();
                        map.panTo(pt);
                        var message = 'latitude: ' + pt.lat().toFixed(5) + ', longitude: ' + pt.lng().toFixed(5);
                        document.getElementById("geocodeRoboGEO").value = message;
                        //document.getElementById("lat").innerHTML = pt.lat().toFixed(5);
                        //document.getElementById("lng").innerHTML = pt.lng().toFixed(5);
                    });


                    GEvent.addListener(map, "moveend", function() {
                        map.clearOverlays();
                        var center = map.getCenter();
                        var marker = new GMarker(center, {draggable: true});
                        map.addOverlay(marker);
                        var message = 'latitude: ' + center.lat().toFixed(5) + ', longitude: ' + center.lng().toFixed(5);
                        document.getElementById("geocodeRoboGEO").value = message;
                        //document.getElementById("lat").innerHTML = center.lat().toFixed(5);
                        //document.getElementById("lng").innerHTML = center.lng().toFixed(5);

                        GEvent.addListener(marker, "dragend", function() {
                            var pt = marker.getPoint();
                            map.panTo(pt);
                            var message = 'latitude: ' + pt.lat().toFixed(5) + ', longitude: ' + pt.lng().toFixed(5);
                            document.getElementById("geocodeRoboGEO").value = message;
                            //document.getElementById("lat").innerHTML = pt.lat().toFixed(5);
                            //document.getElementById("lng").innerHTML = pt.lng().toFixed(5);
                        });

                    });
                } else {
                    var message = 'latitude: ' + point.lat().toFixed(5) + ', longitude: ' + point.lng().toFixed(5);
                    document.getElementById("geocodeRoboGEO").value = message;
                    //document.getElementById("lat").innerHTML = point.lat().toFixed(5);
                    //document.getElementById("lng").innerHTML = point.lng().toFixed(5);
                    map.clearOverlays()
                    map.setCenter(point, 14);
                    var marker = new GMarker(point, {draggable: true});
                    map.addOverlay(marker);

                    GEvent.addListener(marker, "dragend", function() {
                        var pt = marker.getPoint();
                        map.panTo(pt);
                        var message = 'latitude: ' + pt.lat().toFixed(5) + ', longitude: ' + pt.lng().toFixed(5);
                        document.getElementById("geocodeRoboGEO").value = message;
                        //document.getElementById("lat").innerHTML = pt.lat().toFixed(5);
                        //document.getElementById("lng").innerHTML = pt.lng().toFixed(5);
                    });


                    GEvent.addListener(map, "moveend", function() {
                        map.clearOverlays();
                        var center = map.getCenter();
                        var marker = new GMarker(center, {draggable: true});
                        map.addOverlay(marker);
                        var message = 'latitude: ' + center.lat().toFixed(5) + ', longitude: ' + center.lng().toFixed(5);
                        document.getElementById("geocodeRoboGEO").value = message;
                        //document.getElementById("lat").innerHTML = center.lat().toFixed(5);
                        //document.getElementById("lng").innerHTML = center.lng().toFixed(5);

                        GEvent.addListener(marker, "dragend", function() {
                            var pt = marker.getPoint();
                            map.panTo(pt);
                            var message = 'latitude: ' + pt.lat().toFixed(5) + ', longitude: ' + pt.lng().toFixed(5);
                            document.getElementById("geocodeRoboGEO").value = message;
                            //document.getElementById("lat").innerHTML = pt.lat().toFixed(5);
                            //document.getElementById("lng").innerHTML = pt.lng().toFixed(5);
                        });

                    });

                }
            }
        );
        }
    }
                                    </script>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Tiêu đề: <font color="#FF0000">*</font></div>
                                <div class="divform"><input type="text" id="title" name="title" value="<?php echo htmlentities($rsPropertyEdit['rsPropertyEdit']['title'], ENT_QUOTES, 'UTF-8');?>" style="width:95%;"/></div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Thư viện ảnh:</div>
                                <div class="divform" style="width:75%;">
                                    <div style="float:left;width:100%;">
                                        <div><input type="button" value="Chọn ảnh" onclick="popupImages('&forModule=property');" class="button" style="width:100px;" /><div style="padding-top:8px">&nbsp;&nbsp;&nbsp;&nbsp;Ảnh đầu tiên sẽ được dùng làm ảnh hiển thị.</div></div>
                                    </div>

                                    <div id="removeThumb"></div>
                                    <div id="propertyImagesThumb">
                                        <?php
                                        if(intval($rsPropertyEdit['rsPropertyEdit']['id'])>0) {
                                            $sqlImage = "SELECT * from property_image WHERE property_id=".intval($rsPropertyEdit['rsPropertyEdit']['id']);
                                            $rsImage = $db->query($sqlImage);
                                            while($rs=$db->fetch_array($rsImage)) {
                                                $randNumber = rand(999,999999999);
                                                echo  '<div id="'.$randNumber.'">
                                                                <input type="hidden" id="image" name="thumb[]" value="'.$rs['image'].'"/>
                                                                <img id="imgDisplay" src="'.$rs['image'].'" style="float:left;border:3px solid #CCC;margin-right:5px;margin-top:5px;width:87px;height:87px;" alt=""/>
                                                                <a title="Delete this image" class="removeImage" href="javascript:removeImage(\''.$randNumber.'\',\''.$rs['id'].'\');"></a>
                                                            </div>';
                                            }
                                        }
                                        ?>
                                    </div>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Mô tả: <font color="#FF0000">*</font></div>
                                <div class="divform"><textarea id="description" name="description" cols="10" rows="10" style="overflow:hidden;width:99%;"><?php echo $rsPropertyEdit['rsPropertyEdit']['description'];?></textarea></div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Hường nhà:</div>
                                <div class="divform">
                                    <select name="direction">
                                        <?php
                                        foreach ($CONFIG['property_direction'] as $key => $value) {
                                            echo '<option '.setSelectedBoxValue($rsPropertyEdit['rsPropertyEdit']['direction'], $key).' value="'.$key.'">'.$value.'</option>';
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Giấy tờ:</div>
                                <div class="divform">
                                    <select name="legal_doc" style="width:150px;float:left;">
                                        <?php
                                        $arrLegalDoc = array('Chọn loại giấy tờ...','Sổ đỏ','Sổ hồng','Giấy tờ khác');
                                        foreach ($arrLegalDoc as $key => $value) {
                                            echo '<option '.setSelectedBoxValue($rsPropertyEdit['rsPropertyEdit']['legal_doc'], $value).' value="'.$key.'">'.$value.'</option>';
                                        }
                                        ?>
                                    </select>
                                    <?php
                                    if(!in_array($rsPropertyEdit['rsPropertyEdit']['legal_doc'], $arrLegalDoc)) {
                                        echo '<input type="text" name="other_legal_doc" value="'.$rsPropertyEdit['rsPropertyEdit']['legal_doc'].'" style="float:left;width:300px;height:17px;margin-left:5px;">';
                                    }else {
                                        echo '<input type="text" name="other_legal_doc" style="display:none;float:left;width:300px;height:17px;margin-left:5px;">';
                                    }
                                    ?>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Diện tích sàn:</div>
                                <div class="divform">
                                    <input type="text" id="area_build" name="area_build" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['area_build'];?>"/> m2
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Diện tích sử dụng:</div>
                                <div class="divform">
                                    <input type="text" id="area_use" name="area_use" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['area_use'];?>"/> m2
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">DT khuôn viên:</div>
                                <div class="divform">
                                    Rộng: <input type="text" id="area_campus_width" name="area_campus_width" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['area_campus_width'];?>" style="width:104px;"/> m &nbsp;&nbsp; <span style="color:red;">X</span> &nbsp;&nbsp;
                                    Dài: <input type="text" id="area_campus_depth" name="area_campus_depth" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['area_campus_depth'];?>" style="width:100px;"/> m
                                </div>
                            </div>

                            <div class="lineform">
                                <div class="divlabel_news" style="line-height:15px;">Giá:</div>
                                <div class="divform">
                                    <input type="text" id="price" name="price" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['price'];?>" maxlength="20"/> Triệu đồng
                                    <div style="margin-top:10px;">
                                        <div>Giá: <span id="showPrice" style="font-weight:bold;color:green;"><?php if(isset($rsPropertyEdit['rsPropertyEdit']['price'])) {
                                                    echo $rsPropertyEdit['rsPropertyEdit']['price'];
                                                }else {
                                                    echo '0';
                                                }?></span> Triệu đồng.</div>
                                    </div>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Số phòng:</div>
                                <div class="divform">
                                    <input type="text" id="room" name="room" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['room'];?>"/> Chỉ nhập số.
                                </div>
                            </div>                          
                            <div class="lineform">
                                <div class="divlabel_news">Số phòng khách:</div>
                                <div class="divform">
                                    <input type="text" id="sittingroom" name="sittingroom" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['sittingroom'];?>"/> Chỉ nhập số.
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Số phòng tắm:</div>
                                <div class="divform">
                                    <input type="text" id="bathroom" name="bathroom" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['bathroom'];?>"/> Chỉ nhập số.
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Số phòng bếp:</div>
                                <div class="divform">
                                    <input type="text" id="kitchen" name="kitchen" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['kitchen'];?>"/> Chỉ nhập số.
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Số phòng ngủ:</div>
                                <div class="divform">
                                    <input type="text" id="bedroom" name="bedroom" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['bedroom'];?>"/> Chỉ nhập số.
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Số tầng:</div>
                                <div class="divform">
                                    <input type="text" id="floor" name="floor" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['floor'];?>"/> Chỉ nhập số.
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Đường rộng:</div>
                                <div class="divform">
                                    <input type="text" id="way" name="way" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['way'];?>"/>m
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Năm xây dựng:</div>
                                <div class="divform">
                                    <input type="text" id="build_year" name="build_year" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['build_year'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Năm sửa chữa:</div>
                                <div class="divform">
                                    <input type="text" id="repair_year" name="repair_year" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['repair_year'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Chỗ để ôtô:</div>
                                <div class="divform">
                                    <select name="gara_oto">
                                        <option value="yes">Có</option>
                                        <option value="no">Không</option>
                                    </select>

                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Tổ chức định giá:</div>
                                <div class="divform">
                                    <input type="text" id="org_price" name="org_price" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['org_price'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Ngày định giá:</div>
                                <div class="divform">
                                    <input readonly type="text" onclick="return showCalendar('date_price');" id="date_price" name="date_price" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['date_price'];?>"/>
                                    <img src="<?php echo ADMIN_IMAGES_URL;?>/calendar.png" onclick="return showCalendar('date_price');">
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Trạng thái:</div>
                                <div class="divform">
                                    <select name="status">
                                        <?php
                                        $arrStatus = array('actived'=>'Kích hoạt','pending'=>'Chờ kích hoạt','closed'=>'Đã hết hàng');
                                        foreach ($arrStatus as $key => $value) {
                                            if(isset($rsPropertyEdit['rsPropertyEdit']['status']) && $rsPropertyEdit['rsPropertyEdit']['status']==$key) {
                                                echo '<option selected="selected" value="'.$key.'">'.$value.'</option>';
                                            }else {
                                                echo '<option value="'.$key.'">'.$value.'</option>';
                                            }
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>                            
                           <div class="lineform">
                                <div class="divlabel_news">Thứ tự hiển thị:</div>
                                <div class="divform">
                                    <input type="text"  id="num_order" name="num_order" value="<?php echo $rsPropertyEdit['rsPropertyEdit']['order_num'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div><b>Thông tin liên hệ</b></div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Tên:</div>
                                <div class="divform">
                                    <input type="text" id="contactName" name="contactName" value="<?php echo $rsPropertyEdit['rsPropertyContactEdit']['name'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Email:</div>
                                <div class="divform">
                                    <input type="text" id="contactEmail" name="contactEmail" value="<?php echo $rsPropertyEdit['rsPropertyContactEdit']['email'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Địa chỉ:</div>
                                <div class="divform">
                                    <input type="text" id="contactAddress" name="contactAddress" value="<?php echo $rsPropertyEdit['rsPropertyContactEdit']['address'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Điện thoại:</div>
                                <div class="divform">
                                    <input type="text" id="contactPhone" name="contactPhone" value="<?php echo $rsPropertyEdit['rsPropertyContactEdit']['phone'];?>"/>
                                </div>
                            </div>
                            <div class="lineform">
                                <div class="divlabel_news">Di động:</div>
                                <div class="divform">
                                    <input type="text" id="contactMobile" name="contactMobile" value="<?php echo $rsPropertyEdit['rsPropertyContactEdit']['mobile'];?>"/>
                                </div>
                            </div>


                        </div>
                        
                    </div>
                    <div class="spacer1"><span></span></div>
                </fieldset>
                <div class="linesubmit">
                    <input type="hidden" name="submitType" id="submitType" value="">
                    <input type="submit" name="submitFrmPropertyAdd" id="submitFrmPropertyAdd" value="Lưu lại" class="button" />
                    
                    <input type="button" onclick="document.location='?module=property';" value="Thoát" class="button" />
                </div>
            </div>
        </div>
    </form>
</div>
<?php
include "inc/right.php";
include ADMIN_INCLUDE_DIR."/footer.php";
?>